package com.isoft.systemconsumer.controller;

import com.isoft.systemconsumer.bean.SysUser;
import com.isoft.systemconsumer.service.openFeign.SysUserOpenFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("systemconsumer/sysuser")
@Slf4j
public class SysUserOpenFeignController {
    @Autowired
    SysUserOpenFeignService sysUserOpenFeignService;
    /*无安全框架登录测试*/
    @PostMapping("logintest")
    public SysUser loginTest(String username , String password){
        log.info("SystemConsumer远程访问SystemProvidor的loginTest");
        return sysUserOpenFeignService.loginTest(username , password);
    }
    /*获取所有用户信息*/
    @GetMapping("getall")
    public List<SysUser> getAllSysUser(){
        log.info("SystemConsumer远程访问SystemProvidor的getAllSysUser");
        return sysUserOpenFeignService.getAllSysUser();
    }
    /*根据ID获取用户信息*/
    @GetMapping("{sysuid}")
    public SysUser getById(@PathVariable("sysuid") Integer id){
        log.info("SystemConsumer远程访问SystemProvidor的getById");
        return sysUserOpenFeignService.getById(id);
    }
}
